# -*- coding: utf-8-*-
from openerp.osv import osv


# 微信企业号菜单
class weixin_sync_content(osv.osv_memory):
    _name = 'weixin.sync.content'
    _description = u"微信同步操作"

    def sync_content(self, cr, uid, ids, context=None):
        context = context or {}
        active_ids = context.get('active_ids')
        model = self.pool.get(context.get('active_model'))

        if context.get('active_model') == 'weixin.contacts':
            return model.sync_contacts(cr, uid, active_ids, context=context)

        if model and active_ids:
           self.pool.get('hr.employee').compare_employee_construct(cr, uid, active_ids, context=context)
        else:
            raise osv.except_osv(u'错误', u'没有选中任何需要同步的数据')
